//引入封装的axios
import request from '../util/request';
//引入url封装的js
import { KEY, API_24H, API_7D, API_CITY, API_NOW, API_AIR } from "../api/urlAPI"

// 未来24小时请求
export const fetch24HourData = (locationID) => {
  return request.get(API_24H, {
    params: {
      location: locationID,
      key: KEY,
    }
  })
}
// 未来7日请求
export const fetch7DayData = (locationID) => {
  return request.get(API_7D, {
    params: {
      location: locationID,
      key: KEY,
    }
  })
}

// 城市搜索请求
export const fetchCityData = (cityName) => {
  return request.get(API_CITY, {
    params: {
      location: cityName,
      key: KEY,
    }
  })
}

//实时天气请求
export const fetchNowData = (locationID) => {
  return request.get(API_NOW, {
    params: {
      location: locationID,
      key: KEY,
    }
  })
}


//实时质量请求
export const fetchAirData = (latitude,longitude) => {
  return request.get(API_AIR + "/"+latitude+"/"+longitude, {
    params: {
      // location: ,
      key: KEY,
    }
  })
}
